#pragma once

#define AVAILABLE_LETTERS "1234567890-=!@#$%^&*()_+qwertyuiop[]QWERTYUIOP{}asdfghjkl;'\ASDFGHJKL:\"|\\zxcvbnm,./|ZXCVBNM<>?"

#define LOG_HTML_BEGIN "<html><head><script>var data = Array("

#define LOG_HTML_END "\"$$$$\"); \
function Refresh(){ var content = \"\"; \
var iterator = 0; \
var ticker = false; \
for(var i = 0; i < data.length; ++i){ \
var tab = data[i].split(\"$\"); \
if( (tab[2].indexOf(document.getElementById(\"filter_function\").value) != -1) && \
    (tab[3].indexOf(document.getElementById(\"filter_file\").value) != -1) && \
	( \
	(tab[1] == \"I\" && document.getElementById(\"show_info\").checked) || \
	(tab[1] == \"W\" && document.getElementById(\"show_warning\").checked) || \
	(tab[1] == \"E\" && document.getElementById(\"show_error\").checked) || \
	(tab[1] == \"C\" && document.getElementById(\"show_crash\").checked) \
	) \
  ){ iterator++; \
if(ticker = !ticker) content += \"<tr class=\\\"tdtd\\\">\"; else content += \"<tr>\"; \
content += \"<td class=\\\"ttime\\\"><pre>\" + tab[0] + \"</pre></td><td class=\\\"ttype\\\"><pre>\" + tab[1] + \"</pre></td><td class=\\\"tfunction\\\">\"; \
var tabdwa = tab[2]; \
tabdwa = tabdwa.replace('<', '&lt;'); \
tabdwa = tabdwa.replace('>', '&gt;'); \
var ftab = tabdwa.split(\"::\"); \
if(ftab.length == 2) { \
content += \"<a href=\\\"#\\\" onclick=\\\"SetFuncFilter('\" + ftab[0] + \"')\\\">\" + ftab[0] + \"</a>\"; \
content += \" ::&nbsp;<a href=\\\"#\\\" onclick=\\\"SetFuncFilter('\" + tab[2] + \"')\\\">\" + ftab[1] + \"</a>\"; \
} \
else { \
content += \"<a href=\\\"#\\\" onclick=\\\"SetFuncFilter('\" + tab[2] + \"')\\\">\" + tab[2] + \"</a>\"; \
} \
content += \"</td><td class=\\\"tfile\\\"><a href=\\\"#\\\" onclick=\\\"SetFileFilter('\" + tab[3] + \"')\\\"><pre>\" + tab[3] + \"</pre></a></td><td class=\\\"tline\\\"><pre>\" + tab[4] + \"</pre></td><td class=\\\"tmessage\\\"><pre>\" + tab[5] + \"</pre></td></tr>\";}} \
content += \"</table>\"; \
content = \"<table><tr><td class=\\\"ttop ttime\\\">Time</td><td class=\\\"ttop ttype\\\">Type</td><td class=\\\"ttop tfunction\\\">Function</td><td class=\\\"ttop tfile\\\">File</td><td class=\\\"ttop tline\\\">Line</td><td class=\\\"ttop tmessage\\\">Message<span style=\\\"float:right\\\">| &nbsp;Found \" + iterator + \" results</span></td></tr>\" + content; \
document.getElementById(\"content\").innerHTML = content; \
} \
function SetFuncFilter(ffilter) { \
	document.getElementById(\"filter_function\").value = ffilter; \
	Refresh(); \
} \
function SetFileFilter(ffilter) { \
	document.getElementById(\"filter_file\").value = ffilter; \
	Refresh(); \
} \
</script> \
<style> \
a:visited{color:black}\
html{overflow-y: scroll;} \
pre{margin:0;padding:0;} \
td{padding:4px;border:solid 1px #fff;} \
.tdtd td{background:#ccc;border:solid 1px #666;} \
*{font-family: Verdana;font-size: 10px;} \
table,content,tr{width:100%%;} \
.ttop{background:black;color:white;font-weight:bold;border:solid 1px black} \
.ttime{width:55px;} \
.ttype{width:50px;} \
.tfile{width:100px;} \
.tline{width:55px;} \
.tfunction{width:250px;} \
.filters{width:350px;float:left;} \
.filters label{width:100px;display:block;} \
.filters input{margin-bottom:8px; width:300px;} \
.title{font-size:18px;float:right} \
.title span{font-size:10px;float:right;} \
#control{padding:10px;border:solid 1px black;width:560px;margin:2px;} \
</style></head><body onload=\"Refresh()\"> \
<div class=\"title\">ViaLactea<br/><span>Engine Logfile</span></div> \
<div id=\"control\"> \
<div style=\"width:200px;float:left\" > \
<input type=\"checkbox\" id=\"show_info\" onclick=\"Refresh()\" checked /> Show Informations </br> \
<input type=\"checkbox\" id=\"show_warning\" onclick=\"Refresh()\" checked /> Show Warnings </br> \
<input type=\"checkbox\" id=\"show_error\" onclick=\"Refresh()\" checked /> Show Errors </br> \
<input type=\"checkbox\" id=\"show_crash\" onclick=\"Refresh()\" checked /> Show Crashes \
</div> \
<div class=\"filters\"> \
<label for=\"func\">Functions filter:</label><input name=\"func\"type=\"text\" id=\"filter_function\" onkeyup=\"Refresh()\" /><input style=\"width:45px\" type=\"button\" value=\"Clear\" onclick=\"SetFuncFilter('')\" /></br> \
<label for=\"file\">Files filter:</label><input name=\"file\" type=\"text\" id=\"filter_file\" onkeyup=\"Refresh()\" /><input style=\"width:45px\" type=\"button\" value=\"Clear\" onclick=\"SetFileFilter('')\" /></div> \
<div style=\"clear:both\"></div> \
</div> \
<div id=\"content\"></div> \
</body> \
</html>"